<?php

namespace App\Admin\Controllers\Mining;

use App\Admin\Repositories\Mining\UserMining;
use App\Admin\Forms\Mining\MiningExcel;
use App\Common\CommonModel;
use App\Models\Finance\Wallet;
use App\Models\Finance\WalletLog;
use App\Models\Goods\UserProduct;
use App\Models\Goods\UserProductPower;
use App\Models\Mining\UserMiningShare;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use phpDocumentor\Reflection\Utils;



class UserMiningController extends AdminController
{

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new UserMining(['user','userProduct']), function (Grid $grid) {
            $grid->column('user_id');
            $grid->column('user.username');
            $grid->column('order_id');
            $grid->column('userProduct.product_title');
            $grid->column('coin');
            $grid->column('tech_fee');
            $grid->column('once_produce');
            $grid->column('phs_ratio');
            $grid->column('amount');
            $grid->column('date');
            $grid->column('status');
            $grid->column('created_at');
            $grid->column('updated_at');

            $grid->tools(function (Grid\Tools $tools){

                if(Admin::user()->can("/mining/user_mining/create")){

                    $tools->append(new  MiningExcel());
                }

            });
            $grid->disableDeleteButton();
            $grid->disableBatchDelete();
            $grid->disableEditButton();
            $grid->perPages([5,10,20,50,100,200,500,1000]);

        });
    }

}
